package cn.org.gldd.agent.controller;

import cn.org.gldd.agent.service.KnowledgeService;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/knowledge")
public class KnowledgeController {

    @Resource
    KnowledgeService knowledgeService;


    @GetMapping("chat")
    public Flux<String> knowledgeChat(@RequestParam("message") String message) {
        return knowledgeService.vectorSearch(message);
    }

    @PostMapping("splitDoc")
    public Boolean splitDocument(MultipartFile file){
        return knowledgeService.handleSplitDocument(file);
    }
}
